<template>
  <view class="mobile-item-container">
    <Navbar title="公告详情" bgColor="#fff" :h5Show="true"></Navbar>
    <view style="font-size: 40rpx; font-weight: bold;">{{notice.noticeTitle}}</view>
    <view style="display: flex; font-size: 12px; color: #909399;">
      <u-icon name="clock" size="12"></u-icon>
      <text>{{notice.createTime}}</text>
      <u-icon name="account" size="12"></u-icon>
      <text>{{notice.remark}}</text>
    </view>
    <view style="margin-top: 40rpx;">
      <u-parse :content="notice.noticeContent"></u-parse>
    </view>
	<u-row :gutter="16" style="margin-top: 36px;">
		<u-col :span="6">
		  <u-button icon="arrow-left" text="返回" plain @click="goBack()"></u-button>
		</u-col>	
	  <u-col :span="6">
	    <u-button type="primary" text="公告确认" @click="submit"></u-button>
	  </u-col>
	</u-row>
	
	<u-notify ref="uNotify"></u-notify>
  </view>
</template>

<script>
import * as NoticeApi from '@/api/work/notice'
import Navbar from '@/components/navbar/Navbar'

export default {
  components: {
    Navbar,
  },
  data () {
    return {
      noticeId: undefined,
      notice: {}
    }
  },
  onLoad (params) {
    this.noticeId = params.id
    this.loadData()
  },
  methods: {
	submit(){
		NoticeApi.noticeCheck(this.noticeId).then(res => {
			this.$refs.uNotify.success('确认成功！')
			this.goBack()
		})
	},
    goBack() {
      uni.navigateBack({
          delta: 1, // 返回层数，2则上上页
          success() {
              uni.$emit('update',{msg:'页面更新'})
          }
      })
    },
    loadData () {
      const app = this
      NoticeApi.noticeById(this.noticeId).then(res => {
        app.notice = res.data
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
